﻿using School;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;

namespace TestCourse
{
    
    
    /// <summary>
    ///This is a test class for CourseTest and is intended
    ///to contain all CourseTest Unit Tests
    ///</summary>
    [TestClass()]
    public class CourseTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for Course Constructor
        ///</summary>
        [TestMethod()]
        public void CourseConstructorTest()
        {
            Course target = new Course("Telerik");
            Assert.AreEqual("Telerik", target.Name);
            Assert.AreNotEqual(target.Students, null);
            Assert.AreNotEqual(target.Students.Count, 0);
        }

        /// <summary>
        ///A test for AddStudent
        ///</summary>
        [TestMethod()]
        public void AddStudentTest()
        {
            Course target = new Course("Telerik");
            Student s = new Student("Filip", 71057); // TODO: Initialize to an appropriate value
            target.AddStudent(s);
            Assert.IsTrue(target.Students.Count == 1);
            Assert.IsTrue(target.Students.Contains(s));

        }

        /// <summary>
        ///A test for RemoveStudent
        ///</summary>
        [TestMethod()]
        public void RemoveStudentTest()
        {
            Course target = new Course("Telerik");
            Student s = new Student("Filip", 71057); // TODO: Initialize to an appropriate value
            target.AddStudent(s);
            Assert.IsTrue(target.Students.Count == 1);
            Assert.IsTrue(target.Students.Contains(s));
            target.RemoveStudent(s);
            Assert.IsTrue(target.Students.Count == 0);
            Assert.IsFalse(target.Students.Contains(s));
        }

        /// <summary>
        ///A test for Name
        ///</summary>
        [TestMethod()]
        public void NameTest()
        {
            Course target = new Course("asd");
            string expected = "Telerik"; // TODO: Initialize to an appropriate value
            string actual;
            target.Name = expected;
            actual = target.Name;
            Assert.AreEqual(expected, actual);
        }


    }
}
